/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */
#ifndef __ADT_CHUNK_FILE_H__
#define __ADT_CHUNK_FILE_H__

#include "WowCommon.h"
#include "Adt.h"
#include "FileBase.h"

namespace PQGameCore
{
	/*
	parse map chunk
	*/
	class AdtChunkFile
	{
	public:
		AdtChunkFile(PQEngine::FileBase* file,int index,adt_mcin *info);
		~AdtChunkFile(void);

		void init(PQEngine::FileBase* file,adt_mcin *info);
		bool readLayerShadowMap(PQEngine::FileBase *f,map_chunk_header *header);
		bool readLayerInfo(PQEngine::FileBase *f,map_chunk_header *header);
		bool readVerticesHeight(PQEngine::FileBase *f,map_chunk_header *header);
		bool readVerticesNormal(PQEngine::FileBase *f,map_chunk_header *header);
		bool readLayerAlphaMap(PQEngine::FileBase *f,map_chunk_header *header);
		void genAlphaMap(PQEngine::FileBase *f);
	public:
		map_chunk_header *header;

		float *heights;//ptr to 9*9+8*8  vertices height(a chunck)
		map_chunk_normal *normals;
		int layerCount;//texture layer count up to 4
		map_chunk_layer *layersInfo;
		unsigned char* blendMap;//64*64*4
		unsigned char* alphaMaps[MAX_TEXTURE_LAYERS];//64*64
		unsigned char* shadowMap;//64*64
		int textureSizes[4];
		int chunkHeaderPos;
	};
}
#endif
